<script language=JavaScript>
function initObjects() {
	var now = new Date()
	var nowHours = now.getHours()
	var nowMinutes = now.getMinutes()
	var nowSeconds = now.getSeconds()
	
	//shows the menu at the end so that we dont get reference
	//for instance objects that are not yet fully loaded
//	if (document.all('menuBar'))
//		document.all("menuBar").style.display = "";
		
	document.all.txtStartHours.value = nowHours;
	document.all.txtStartMinutes.value = nowMinutes;
	document.all.txtStartSeconds.value = nowSeconds;
	//document.all.colon.style.display = "";
	setupDescriptions();
	tickIE("A");			
 }
 
 function initObjectsPop() {
	var now = new Date()
	var nowHours = now.getHours()
	var nowMinutes = now.getMinutes()
	var nowSeconds = now.getSeconds()
	
	//shows the menu at the end so that we dont get reference
	//for instance objects that are not yet fully loaded
//	if (document.all('menuBar'))
//		document.all("menuBar").style.display = "";
		
	document.all.txtStartHours.value = nowHours;
	document.all.txtStartMinutes.value = nowMinutes;
	document.all.txtStartSeconds.value = nowSeconds;
	//document.all.colon.style.display = "";
	setupDescriptions();
	tickIE("B");			
 }
 
function tickIE(sMode) {
	var sHours, sMinutes, sSeconds, iRemaining
	var now = new Date()
	var nowHours = now.getHours()
	var nowMinutes = now.getMinutes()
	var nowSeconds = now.getSeconds()
	var thenHours = parseInt(document.all.txtStartHours.value)
	var thenMinutes = parseInt(document.all.txtStartMinutes.value)
	var thenSeconds = parseInt(document.all.txtStartSeconds.value)
	var iStart
	var iEnd, iLimit
	
	iLimit = 600;
	
	iStart = (thenHours * 60 * 60) + (thenMinutes * 60) + (thenSeconds)
	iEnd = (nowHours * 60 * 60) + (nowMinutes * 60) + (nowSeconds)
	
	iRemaining = iLimit - (iEnd - iStart)
	
	if (parseInt(iRemaining/60) < 10) {
		document.all.txtTimer1.value = "0" + parseInt(iRemaining/60)
	}
	else {
		document.all.txtTimer1.value = parseInt(iRemaining/60)
	}
	
	if (iRemaining - parseInt(iRemaining/60)*60 < 10) {
		document.all.txtTimer2.value = "0" + (iRemaining - parseInt(iRemaining/60)*60)
	}
	else {
		document.all.txtTimer2.value = (iRemaining - parseInt(iRemaining/60)*60)
	}
	
	if (iRemaining <= 0 || iRemaining > iLimit){
		document.all.txtTimer1.value = "00";
		document.all.txtTimer2.value = "00";
		Timeout(sMode);
	}	
	else { 
		if (iRemaining == 60) {
			OneMinute();
			var runClock = setTimeout("tickIE('" + sMode + "')", 100);
		}
		else
			var runClock = setTimeout("tickIE('" + sMode + "')", 100);
	}
}
</script>

<script language=VBScript>
	sub OneMinute()
		dim iResp, dNow
		
		dNow = Now()
		iResp = Msgbox("Your session will expire in one minute from " & dNow & ". Do you wish to reset it? (This must be done before this minute expires)", vbExclamation + vbYesNo ,"Timeout")
		If cInt(iResp) = 6 Then 'Yes
			If datediff("s", dNow, Now()) < 60 Then
				document.TimerRefresh.navigate "/mylife/include/TimerRefresh.asp"
				initObjects()
			End If
		else
			Msgbox "Your session will expire in one minute from " & dNow & ". Please save your work or refresh your page within one minute, to avoid having your session cancelled.",vbExclamation,"Timeout"
		end if
	end sub
	
	sub Timeout(sMode)
		If sMode = "A" Then
			' ** Under all timeouts navigate to login.asp
			'
			' if document.all("sRegistered").value = "R" or document.all("sFromBB").value = "Y" Then
			 	window.navigate "/MyLife/pages/Logon/Login.asp?bTimeout=1"
			' else
			'	window.navigate "/MyLife/index.asp?bTimeout=1"
			' end if
		else
			returnvalue="TIMEOUT"
			window.close
		end if
	end sub
</script>
<div style=display:none>
<input type=hidden name=txtStartHours>
<input type=hidden name=txtStartMinutes>
<input type=hidden name=txtStartSeconds>

</div>

<input type=text name=txtTimer1 style="BACKGROUND-COLOR:#ff9900;text-align=right;width:20;BORDER-BOTTOM:medium none;BORDER-LEFT:medium none;BORDER-RIGHT:medium none;BORDER-TOP:medium none;COLOR:white;FONT-FAMILY:Arial;FONT-SIZE:13px;FONT-WEIGHT:bold" value='00'><font style="COLOR:white;FONT-FAMILY:Arial;FONT-SIZE:13px;FONT-WEIGHT:bold">:</font><input type=text name=txtTimer2 style="BACKGROUND-COLOR:#ff9900;width:17;BORDER-BOTTOM:medium none;BORDER-LEFT:medium none;BORDER-RIGHT:medium none;BORDER-TOP:medium none;COLOR:white;FONT-FAMILY:Arial;FONT-SIZE:13px;FONT-WEIGHT:bold" value='00'>

<input name=txtStartHours><input name=txtStartMinutes><input name=txtStartSeconds>

<iframe name=TimerRefresh id=TimerRefresh src="/mylife/include/TimerRefresh.asp" frameborder=0 style=display:none;height=50;width=150></iframe>